<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>邮件报告设置</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">{% load static %}
    <link rel="icon" href="{% static 'layuimini/images/favicon.ico' %}">
    <link rel="stylesheet" href="{% static 'layuimini/lib/layui-v2.5.5/css/layui.css' %}" media="all">
    <link rel="stylesheet" href="{% static 'layuimini/css/layuimini.css' %}" media="all">
    <link rel="stylesheet" href="{% static 'layuimini/lib/font-awesome-4.7.0/css/font-awesome.min.css' %}" media="all">
    <style>
        .layui-top-box {padding:40px 20px 20px 20px;}
        .panel {margin-bottom:17px;background-color:#fff;border:1px solid transparent;border-radius:3px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}
        .panel-body {padding:15px}
        .panel-title {margin-top:0;margin-bottom:0;font-size:14px;color:inherit;}
        .label {display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em;margin-top: .3em;}
        .layui-red {color:red}
        .main_btn > p {height:40px;}
        .amount {font-size:400%;margin-top:10px;margin-bottom:10px;text-align:center;}
    </style>
</head>
<body>
<div class="layuimini-container">
<div class="layuimini-main">
<div class="layuimini-container layuimini-page-anim">
    <div class="layuimini-main layui-top-box">
        <div class="layui-row layui-col-space10">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header">报告接收者</div>
                    <div class="layui-card-body">
                        <div>
                            当前邮件报告接收者为： {% for email in emails %}{{ email }}{% if not forloop.last %}、{% endif %}{% endfor %}，
                            可前往<a href="/admin/auth/user/" target="_blank">「认证和授权 › 用户」</a>进行修改。
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header">报告定时发送</div>
                    <div class="layui-card-body">
                        {% if crontab %}
                        <pre class="layui-code">{{ crontab }}</pre>
                        {% else %}
                        <div>暂无发送邮件报告的定时任务</div>
                        {% endif %}
                    </div>
                </div>
            </div>
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-header">设置定时发送</div>
                    <div class="layui-card-body">
                        <form class="layui-form" action="" method="post">
                            {% csrf_token %}
                          <div class="layui-form-item">
                              <label class="layui-form-label">发送时间</label>
                              <div class="layui-input-inline">
                                  <input type="text" name="dispatch" {% if dispatch %}value="{{ dispatch }}"{% endif %} lay-verify="required" required placeholder="请输入发送时间" autocomplete="off" class="layui-input">
                              </div>
                              <div class="layui-form-mid layui-word-aux">Crontab表达式</div>
                          </div>
                          <div class="layui-form-item">
                            <div class="layui-input-block">
                              <button class="layui-btn" lay-submit>设置</button>
                            </div>
                          </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
</div>
<script src="{% static 'layuimini/lib/layui-v2.5.5/layui.js' %}" charset="utf-8"></script>
<script src="{% static 'layuimini/js/lay-config.js' %}" charset="utf-8"></script>
<script>
    layui.use('code', function(){ //加载code模块
        layui.code({
          title: '发送邮件报告定时任务, 读取于{{ time }}',
          about: false
        });
    });
    {% if error_msg %}
    layui.use('layer', function(){
        var layer = layui.layer;
        layer.msg("{{ error_msg }}");
    });
    {% endif %}
</script>
</body>
</html>
